---
slug: 后端bug记录 #路径，不能重复
title: 后端bug记录 # 标题
authors: [] # 作者，在authors.yml配置
tags: [facebook, hello, docusaurus] # 标签，在tags.yml配置
toc_min_heading_level: 2 # 最小展示标题
toc_max_heading_level: 5 # 最大展示标题
---

##### `String.format`碰到字符串模糊查询

> format方法碰到`%`会转化,所以要用两个百分号防止转义

```java
String sql = "select id,name from blade_user where name like '%%123%%'";

```


### MultipartFile上传文件异常

```shell
Maximum upload size exceeded; nested exception is java.lang.IllegalStateException: org.apache.tomcat.util.http.fileupload.impl.FileSizeLimitExceededException: The field file exceeds its maximum permitted size of 1048576 bytes.
```

**tomcat默认限制文件上传大小为1MB**

#### 解决:
```yaml
spring:
  servlet:
  multipart:
    max-file-size: 100MB
    max-request-size: 100MB

```


```yaml
server:
  tomcat:
    max-http-form-post-size: 2GB

```
